/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
 * Description: Hmfs-tools resize command
 */

#ifndef RESIZE_COMMAND_H
#define RESIZE_COMMAND_H

#include <getopt.h>
#include <iostream>
#include <string>
#include <sys/types.h>

#include "hmfs_command.h"

namespace OHOS {
namespace Hmfs {
enum Option {
    END = -1,
    HELP = 'h',
    DEBUG = 'd',
    EXNODEBITMAP = 'i',
    OVERPROVISION = 'o',
    SAFE = 's',
    TARGETSECTOR = 't',
    FEATURELIST = 'O',
    ENCODING = 'C',
    RVERSION = 'V',
    FORCEWRITE = 'f',
    UNKNOWN = '?',
    NO_ARGUMENT = ':',
};

class ResizeCmdParser : public CmdParser {
public:
    ResizeCmdParser(CmdConfig &resizeConfig);
    ~ResizeCmdParser() = default;
    uint32_t Parse(int argc, char *argv[]);
    void ShowCmdUsage();

private:
    ArgParseResult OptionAProcess(const std::string &argValue);
    ArgParseResult PrintVersion(const std::string &argValue);
    ArgParseResult ShowHelp(const std::string &argValue);
    ArgParseResult SetDebugLevel(const std::string &argValue);
    ArgParseResult SetForce(const std::string &argValue);
    ArgParseResult SetSafe(const std::string &argValue);
    ArgParseResult SetTargetSectors(const std::string &argValue);
    ArgParseResult SetEncoding(const std::string &argValue);
    ArgParseResult SetOverProvision(const std::string &argValue);
    ArgParseResult SetExnodeBitmap(const std::string &argValue);
    ArgParseResult SetFeatureList(const std::string &argValue);
    std::vector<std::string> SplitStringList(const std::string &srcString, char delimiter);
    static const struct option CMD_OPTS[];
    static const std::string CMD_PARAMS;
    CmdConfig &resizeConfig_;
};

}
}
#endif // RESIZE_COMMAND_H
